<template>
  <el-dialog
    title='温馨提示'
    :visible.sync="innerVisible"
    width="500px"
    center
  >
    <!--<el-form class="el-form-col" label-width="110px" :label-position="labelPosition">-->
    <!--</el-form>-->
    <table class="table show-table table-align-middle">
      <tbody>
      <tr>
        <td width="120">库存包件总数:</td>
        <td width="28%"><span class="font-red">{{submitData.realityAll}}</span></td>
        <td width="120">实际包件总数:</td>
        <td width="25%"><span class="font-red">{{submitData.totalPackage}}</span></td>
      </tr>
      <tr>
        <td>盘溢总数:</td>
        <td><span class="font-red">{{submitData.totalOverflow}}</span></td>
        <td>盘亏总数:</td>
        <td><span class="font-red">{{submitData.totalLoss}}</span></td>
      </tr>
      <tr>
        <td class="font-red" style="text-align: center" colspan="4">
          请仔细核对包件数量，提交后包件的库存数量将根据实际包件数量发生改变，同时锁定的区域将自动解除
        </td>
      </tr>
      </tbody>
    </table>
    <div slot="footer" class="dialog-footer">
      <el-button @click.prevent="hide" type="primary">取消</el-button>
      <el-button @click.prevent="submit" :loading="loading" type="primary">确定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'registerModal',
  props: {
    submitData: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      labelPosition: 'left',
      innerVisible: false,
      loading: false
    }
  },
  methods: {
    show() {
      this.innerVisible = true
    },
    hide() {
      this.innerVisible = false
    },
    submit() {
      this.loading = true
      this.$ajax.post('/ms-warehouse-order/inventory/saveInventoryItem', this.submitData.data).then(reponse => {
        if (reponse.success) {
          this.hide()
          this.$emit('init')
          this.$message({
            type: 'success',
            message: '提交成功!'
          })
          this.$router.push({path: '/ss-oms/warehouse/inventory/index'})
        }
        this.loading = false
      }).catch(_ => {
        this.loading = false
      })
    }
  }
}
</script>

<style scoped>

</style>
